<?php

namespace app\admin\validate;

use think\Validate;

class AdminUserValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'username' => 'require|min:3|max:25',
        'password' => 'require|length:6,20',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
        'username.require' => '名称必须',
        'username.max'     => '名称最多不能超过25个字符',
        'username.min'     => '名称最少3个字符',
        'password.require' => '密码必须',
        'password.length'  => '密码必须是6到20位',
    ];
}
